import { ArticlesResponse, ResultListResponse, SearchKeyResponse } from '@/types/data.d.';
import request from "@/utils/request";
type Params = {
  channel_id: number  // 频道id
  timestamp: number   // 当前时间的事件戳 返回当前时间之前的新闻
}
export function getArticleListAPI(params: Params): Promise<ArticlesResponse> {
  return request.get('/articles', {
    params
  })
}
export function getSuggestion(params: { q: string }): Promise<SearchKeyResponse> {
  return request.get('/suggestion', {
    params
  })
}
type Search = {
  page?: number
  per_page?: number
  q: string
}
export function getSearchResultListAPI(params: Search): Promise<ResultListResponse> {
  return request.get('/search', {
    params
  })
}